package qeb.handheldmedical.patient;

import org.json.JSONArray;

import qeb.handheldmedical.R;
import qeb.handheldmedical.adapter.LisResultAdapter;
import qeb.handheldmedical.adapter.PacsAdapter;
import qeb.handheldmedical.adapter.SlideListView;
import qeb.handheldmedical.helper.WSHelper;
import qeb.handheldmedical.model.InPatient;
import qeb.handheldmedical.model.InPatientLis;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class LisResultQuery extends Activity {
	private SlideListView slideListView;
	private LisResultAdapter adapter;
	InPatientLis ipl = new InPatientLis();
	private JSONArray jyresultJsonArray;

	private Button btn_title_back;
	private TextView tv_title;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		ipl = (InPatientLis) getIntent().getSerializableExtra("InPatientLisInfo");

		setContentView(R.layout.query_lisresult);
		initView();
		dataBind();
	}

	private void initView() {
		slideListView = (SlideListView) findViewById(R.id.slideListView6);
		tv_title = (TextView) findViewById(R.id.tv_top_title);
		tv_title.setText(ipl.ZMC);
		btn_title_back = (Button) findViewById(R.id.btn_title_back);
		btn_title_back.setOnClickListener(MyOnClickListener);

	}

	/* 系统主菜单点击事件（在院病人、门诊病人等） */
	private OnClickListener MyOnClickListener = new OnClickListener() {
		@Override
		public void onClick(View v) {
			// TODO 自动生成的方法存根
			// Bundle bundle=new Bundle();
			switch (v.getId()) {
			case R.id.btn_title_back:// 返回按钮
				LisResultQuery.this.finish();
				break;
			default:
				break;
			}
		}
	};

	private void dataBind() {
		jyresultJsonArray = WSHelper.GetLisResultList(ipl.ZXH);//20110923G0040511
		if (jyresultJsonArray != null && jyresultJsonArray.length() > 0) {
			adapter = new LisResultAdapter(jyresultJsonArray.length(), LisResultQuery.this,
					jyresultJsonArray);

			slideListView.setAdapter(adapter);
		}
	}
}